package team.pikachu.pikachuclient.utils;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Created by Alex on 2017/9/16.
 */

public class JsonUtils {
    private static ObjectMapper objectMapper;

    public static <T> T readValue(String content, Class<T> valueType) {
        if (objectMapper == null) {
            objectMapper = new ObjectMapper();
        }
        try {
            return objectMapper.readValue(content, valueType);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

}
